var Dispatcher = require('flux').Dispatcher;
var ListStore = require('./../store/ListStore');

var AppDispatcher = new Dispatcher();

var TestToken = AppDispatcher.register(function(action) {
    console.log(action);
    console.log('abc');
});

AppDispatcher.register(function (action) {
    switch (action.action) {
        case 'ADD_NEW_ITEM':
            //AppDispatcher.waitFor([
            //    TestToken
            //]);
            ListStore.addNewItem(action.text);
            // ListStore.emitChange();
            break;
        default:
            console.log(action);
            break;
    }
});

module.exports = AppDispatcher;
